package com.yudongyang.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.github.pagehelper.PageInfo;
import com.yudongyang.domain.Goods;
import com.yudongyang.service.GoodsService;

@Controller
public class GoodsController {

	@Resource
	private GoodsService goodsService;
	
	@RequestMapping("/list")
	public String list(Model model,Goods g,@RequestParam(defaultValue = "1")Integer pageNum,@RequestParam(defaultValue = "5")Integer pageSize) {
		PageInfo<Goods> info = goodsService.list(g,pageNum,pageSize);
		model.addAttribute("info", info);
		model.addAttribute("g", g);
		return "list";
	}
}
